#include "threadPool.h"
int transfile(int sockfd, char * pathname){
    off_t offset;
    recv(sockfd,&offset,sizeof(off_t),0);
    //发送文件长度
    int fd = open(pathname,O_RDWR);
    struct stat statbuf;
    fstat(fd,&statbuf);
    off_t filesize = statbuf.st_size;
    send(sockfd,&filesize,sizeof(off_t),MSG_NOSIGNAL);
//    printf("filesize = %ld\n",filesize);
    lseek(fd,offset,SEEK_SET);
//    printf("offset = %lu\n",offset);

    sleep(2);
//    printf("开始传输--------------------\n");
    sendfile(sockfd, fd,NULL, filesize - offset);
    close(fd);
    return 0;
}
// v5.0 发大文件 发文件长度 mmap 发内容不用小火车

